<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/pages/login/common.jsp"%>
<%
	String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="B2B电商平台" name="description" />
<meta content="B2B电商平台" name="keyword" />

<title>B2B电商平台.消费者留言回复</title>
<link rel="stylesheet" type="text/css"
	href="<%=path%>/include/css/btn.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/include/css/themes.css" />
<link rel="stylesheet"
	href="<%=path%>/include/JQuery zTree v3.4/css/zTreeStyle/zTreeStyle.css">
<link rel="stylesheet" type="text/css"
	href="<%=path%>/include/css/register_icss.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/include/css/page.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/include/pagination/page.css" media="all">
<link rel="stylesheet"
	href="<%=path%>/include/JQuery ui/css/smoothness/jquery-ui-1.7.3.custom.css"
	type="text/css"></link>
<link rel="stylesheet" type="text/css"
	href="<%=path%>/include/sweetalert/sweetalert.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/include/css/mmt_trading.css" />

<script type="text/javascript"
	src="<%=path%>/include/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/include/JQuery ui/js/jquery-ui-1.7.3.custom.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/include/js/icss.common.js"></script>
<script type="text/javascript" src="<%=path%>/include/js/cookies.js"></script>

<script type="text/javascript"
	src="<%=path%>/include/pagination/jquery.pagination.js"></script>
<script type="text/javascript"
	src="<%=path%>/include/pagination/init.js"></script>

<script type="text/javascript"
	src="<%=path%>/include/sweetalert/sweetalert.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/include/sweetalert/sweetalert-dev.js"></script>
<script src="<%=path%>/include/DatePicker/WdatePicker.js"
	charset="UTF-8" type="text/javascript"></script>

<style type="text/css">
#listTable td {
	font-size:12px;
    border-right: 1px solid #ddd;
    border-bottom:1px solid #ddd;
    padding: 4px;
}

.noborder {
	border: none;
	height: 2px;
	overflow: hidden;
}

.noborder td {
	height: 2px;
}

#listTable th {
	border-right: 1px solid #ddd;
	border-bottom:1px solid #ddd;
	font-weight: bold;
	font-size: 12px;
}
button{
    width:44px;
    height:24px;
    line-height:24px;   
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: 0 -203px;
    border:0;
    cursor:pointer;
    font: 12px/1.5 arial,tahoma,\5b8b\4f53;
    margin: 0 0 0 5px;
    outline:none;
    background-image: url('<%=path%>/include/css/img/xs_bgx.png');   
}

input,select{border-radius: 4px;}
</style>
<script type="text/javascript">
	$(function(){
		_queryList();
	})
	
	var pagination;
	function _queryList(){
		var url = "<%=path%>/custMsg/queryCustMsgList.do";
		var data = {
			beginDate : $("#beginDate").val(),
			endDate : $("#endDate").val(),
			status : $("#status").val()
		};
		pagination = _initPagination({'pageId':'pagination', 'cKey':'queryShopList','url': url,'data': data, 'rows': 8, 'callback':_initDataList});
	}
	function _initDataList(data) {
 		var d = data.rows;
 		var total = data.total;
		var re = new RegExp("\u0001"+"\+", "ig");
		var re1 = new RegExp("\u0002"+"\+", "ig");
		var str = "";
		for(var i=0;i<d.length;i++){
			str += '<tr class="list_table_tr">';
			str += '	<td style="border-left:1px solid #ddd;" nowrap>' + d[i].PID + '</td>';
			str += '	<td  style="text-align:left;" nowrap>' + d[i].USER_NAME + '</td>';
			var content = '';
			if (d[i].MESSAGE_CONTENT == null || d[i].MESSAGE_CONTENT=="") {
				content = "";
			} else {
				content = d[i].MESSAGE_CONTENT.replace(re,"\r").replace(re1,"\n");
			}
			if(content.length > 15){
				content = content.substring(0,15)+"..."
			}
			str += '	<td  style="text-align:left;" nowrap><span title="' + d[i].MESSAGE_CONTENT + '">' + content + '</span></td>';
			str += '	<td  nowrap>' + d[i].MESSAGE_TIME + '</td>';
			var status = d[i].STATUS;
			var statusName = '';
			if(status == '0'){
				statusName = '草稿';
			}else if(status == '1'){
				statusName = '提交';
			}else if(status == '2'){
				statusName = '已回复';
			}
			str += '	<td  nowrap>' + statusName + '</td>';
			str += '	<td  nowrap>';
			if(status == '1'){
				str += '	<a class="list_table_a" onclick="reply(\'' + d[i].MESSAGE_ID + '\');" href="javascript:;">回复</a>';
			}else if(status == '2'){
				str += '	<a class="list_table_a" onclick="detail(\'' + d[i].MESSAGE_ID + '\');" href="javascript:;">查看</a>';
			}
			str += '	</td>';
			str += "</tr>";
		}
		$("#list_tbody").html(str);
		_reHeight();
	 }
	
	function reply(messageId){
	 	document.location.href = "<%=path%>/custMsg/toReplyPage.do?messageId="+messageId;
	 }
	
	function detail(messageId){
	 	document.location.href = "<%=path%>/custMsg/toReplyPage.do?messageId="
				+ messageId + "&type=show";
	}

	function _clear() {
		$("#beginDate").val('');
		$("#endDate").val('');
		$("#status").val('');
	}
</script>
</head>
<body style="font-family: '微软雅黑';padding: 0px;">
	<div id="contentDiv" style="padding:5px; width:99%;">
		<div
			style="width:100%;height:30px;border-bottom:1px solid #ADADAD;margin-bottom: 15px;">
			<div class="toptil">留言管理</div>
		</div>
		<div class="appeal_s"
			style="width: 99.6%;margin: 0px;padding: 10px 0px 0px;">
			<form id="fm" name="fm" method="post" action=""
				novalidate="novalidate">
				<!-- <table style="width:100%;border-collapse: collapse;margin-top:10px; ">
					<tr>
						<td style="width:10%;text-align:right;vertical-align: middle;" nowrap></td>
						<td style="width:25%;" nowrap><input type="text"
							class="Wdate"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true,maxDate:'#F{$dp.$D(\'endDate\')}'})"
							style="width: 140px;height: 24px;margin-bottom: 0px;cursor:pointer;"
							id="beginDate" readOnly name="beginDate"
							onkeydown="if(event.keyCode==13) return false;"></input> 至 <input
							type="text" class="Wdate"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true,minDate:'#F{$dp.$D(\'beginDate\')}'})"
							style="width: 140px;height: 24px;margin-bottom: 0px;cursor:pointer;"
							id="endDate" readOnly name="endDate"
							onkeydown="if(event.keyCode==13) return false;"></input></td>
						<td style="width:10%;text-align:right;" nowrap>状态：</td>
						<td style="width:25%;vertical-align: middle;" nowrap><select id="status"
							name="status" style="width:100%;height: 24px;">
								<option value="">全部</option>
								<option value="1">提交</option>
								<option value="2">已回复</option>
						</select></td>
						<td style="width:30%;vertical-align: middle;" nowrap>
							<button class="orange_search_btn3"
								onmouseover="this.className='orange_search_btn3_hov'"
								onmouseout="this.className='orange_search_btn3'"
								onclick="_queryList()" type="button">查询</button>
							<button class="orange_search_btn3"
								onmouseover="this.className='orange_search_btn3_hov'"
								onmouseout="this.className='orange_search_btn3'"
								onclick="_clear()" type="button">清空</button>
						</td>
					</tr>
				</table> -->
				&nbsp;留言时间：<input type="text" class="Wdate"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true,maxDate:'#F{$dp.$D(\'endDate\')}'})"
							style="width: 140px;height: 24px;margin-bottom: 0px;cursor:pointer;"
							id="beginDate" readOnly name="beginDate"
							onfocus="WdatePicker({position:{left:70,top:87}})"
							onkeydown="if(event.keyCode==13) return false;"></input> 至 <input
							type="text" class="Wdate"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true,minDate:'#F{$dp.$D(\'beginDate\')}'})"
							style="width: 140px;height: 24px;margin-bottom: 0px;margin-right:10px; cursor:pointer;"
							id="endDate" readOnly name="endDate"
							onfocus="WdatePicker({position:{left:229,top:87}})"
							onkeydown="if(event.keyCode==13) return false;"></input>
				状态：<select id="status"
							name="status" style="height: 24px;">
								<option value="">全部</option>
								<option value="1">提交</option>
								<option value="2">已回复</option>
				    </select>
				<!-- <div style="width: 20%;float:right;"> -->
				<button  type="button" onclick="_queryList()">查询</button>
                    <button  type="button" onclick="_clear()">清空</button>
				  <!-- < button class="orange_search_btn3"
								onmouseover="this.className='orange_search_btn3_hov'"
								onmouseout="this.className='orange_search_btn3'"
								onclick="_queryList()" type="button" style="float:none; ">查询</button>
							<button class="orange_search_btn3"
								onmouseover="this.className='orange_search_btn3_hov'"
								onmouseout="this.className='orange_search_btn3'"
								onclick="_clear()" type="button" style="float:none; ">清空</button> -->
				<!-- </div> -->
			</form>
		</div>
		<div class="row-fluid dataTables_wrapper" style="margin-top: 15px;">
			<table id="listTable"
				class="table table-hover table-nomargin table-bordered usertable dataTable"
				style="width: 100%; border-spacing: 0;">
				<thead>
					<tr class="trBgd"
						style="background-color: #eee;text-align: center; height: 31px; border: 1px solid #ddd; white-space: nowrap; background-position: 0 -123px; line-height: 30px; font-weight: bold;">
						<th  nowrap style="border-top:1px solid #ddd;border-left:1px solid #ddd;">序号</th>
						<th  nowrap style="border-top:1px solid #ddd;">消费者</th>
						<th  nowrap style="border-top:1px solid #ddd;">留言</th>
						<th  nowrap style="border-top:1px solid #ddd;">留言时间</th>
						<th  nowrap style="border-top:1px solid #ddd;">状态</th>
						<th  nowrap style="border-top:1px solid #ddd;">操作</th>
					</tr>
				</thead>
				<tbody id="list_tbody" style="font-size: 13px">
				</tbody>
			</table>
			<div class="dataTables_paginate paging_full_numbers">
				<span id="innerHtml"> </span>
			</div>
			<div id="pagination"></div>
			<div>
				<div style="height: 30px;"></div>
				<!-- 分类列表div结束 -->
				<div class="clear"></div>
			</div>
		</div>
	</div>

</body>
<script type="text/javascript">
	$(document).ready(function() {
		_reHeight();
	});
	function _reHeight() {
		var main = $(window.parent.document).find("#rightFrame");
		var mainheight = $("#contentDiv").height();
		main.height(mainheight);
	}
</script>
</html>
